Get Currency guide
The Get Currency guide API enables to fetch the required fields of chosen country and currency as per the VISA currency guide.
Method: POST
{{URL}}/jsonrpc
Headers
Name | Value |
---|---|
Content-Type | application/json |
Example
Payload Parameters
Parameter | Description |
---|---|
id Mandatory | String Unique ID of request Example – "1" |
method Mandatory | String Method Name Example – "VisaService.GetCurrencyGuide " |
params | Object |
api | Object |
credential Mandatory | String API credential provided by NetXD Example – "Basic cy5wYXJhbWVzd2FyYW4rMkBiYW5rY2J3Lm9yZzpUZXN0QDEyMzQ=" |
signature Mandatory | String Signature of the digitally signed payload Example – "MEQCICSDF4HIunb4xDLVEK9IOJYhT6j4wq5FwfJILSb4xbeSAiBdmpkV7uPB+39O6S+ea/61ar3dBmBNSU9ay229vin7sA==" |
payload | Object |
countryCode Mandatory | String Country code of the currency Example – "TH" |
instructedCurrency Mandatory | String Currency code representing the instructed currency Example – "THB" |
isForexRate Mandatory | Boolean Indicating that the exchange involves forex rates Example – true |
sourceCurrencyAlphaCode Mandatory | String The currency code for the source currency in the forex exchange Example – "THB" |
targetCurrencyAlphaCode Mandatory | String The currency code for the target currency in the forex exchange Example – "USD" |
- cURL
- C#
- Go
- NodeJs
curl --location --globoff '{{URL}}/jsonrpc' \
--header 'Content-Type: application/json' \
--data '{"id":"1","method":"VisaService.GetCurrencyGuide","params":{"api":{"credential":"Basic c3VwcG9ydCsxQG5ldHN5cy1pbmMuY29tOjM5ZDYxOGJkNTVmNzQ4ZGQ4ZWY4NWI5NWQxY2RlNDE5","signature":"MEQCICSDF4HIunb4xDLVEK9IOJYhT6j4wq5FwfJILSb4xbeSAiBdmpkV7uPB+39O6S+ea/61ar3dBmBNSU9ay229vin7sA=="},"payload":{"countryCode":"TH","instructedCurrency":"THB","isForexRate":true,"sourceCurrencyAlphaCode":"THB","targetCurrencyAlphaCode":"USD"}}}'
var options = new RestClientOptions("{{URL}}/jsonrpc")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@" ""id"": ""1"",
" + "\n" +
@" ""method"": ""VisaService.GetCurrencyGuide"",
" + "\n" +
@" ""params"": {
" + "\n" +
@" ""api"": {
" + "\n" +
@" ""credential"": ""Basic c3VwcG9ydCsxQG5ldHN5cy1pbmMuY29tOjM5ZDYxOGJkNTVmNzQ4ZGQ4ZWY4NWI5NWQxY2RlNDE5"",
" + "\n" +
@" ""signature"": ""MEQCICSDF4HIunb4xDLVEK9IOJYhT6j4wq5FwfJILSb4xbeSAiBdmpkV7uPB+39O6S+ea/61ar3dBmBNSU9ay229vin7sA==""
" + "\n" +
@" },
" + "\n" +
@" ""payload"": {
" + "\n" +
@" ""countryCode"": ""TH"",
" + "\n" +
@" ""instructedCurrency"": ""THB"",
" + "\n" +
@" ""isForexRate"": true,
" + "\n" +
@" ""sourceCurrencyAlphaCode"": ""THB"",
" + "\n" +
@" ""targetCurrencyAlphaCode"": ""USD""
" + "\n" +
@" }
" + "\n" +
@" }
" + "\n" +
@"}
" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "{{URL}}/jsonrpc"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"id": "1",`+"
"+`
"method": "VisaService.GetCurrencyGuide",`+"
"+`
"params": {`+"
"+`
"api": {`+"
"+`
"credential": "Basic c3VwcG9ydCsxQG5ldHN5cy1pbmMuY29tOjM5ZDYxOGJkNTVmNzQ4ZGQ4ZWY4NWI5NWQxY2RlNDE5",`+"
"+`
"signature": "MEQCICSDF4HIunb4xDLVEK9IOJYhT6j4wq5FwfJILSb4xbeSAiBdmpkV7uPB+39O6S+ea/61ar3dBmBNSU9ay229vin7sA=="`+"
"+`
},`+"
"+`
"payload": {`+"
"+`
"countryCode": "TH",`+"
"+`
"instructedCurrency": "THB",`+"
"+`
"isForexRate": true,`+"
"+`
"sourceCurrencyAlphaCode": "THB",`+"
"+`
"targetCurrencyAlphaCode": "USD"`+"
"+`
}`+"
"+`
}`+"
"+`
}`+"
"+`
`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': '{{URL}}',
'path': '/jsonrpc',
'headers': {
'Content-Type': 'application/json'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"id": "1",
"method": "VisaService.GetCurrencyGuide",
"params": {
"api": {
"credential": "Basic c3VwcG9ydCsxQG5ldHN5cy1pbmMuY29tOjM5ZDYxOGJkNTVmNzQ4ZGQ4ZWY4NWI5NWQxY2RlNDE5",
"signature": "MEQCICSDF4HIunb4xDLVEK9IOJYhT6j4wq5FwfJILSb4xbeSAiBdmpkV7uPB+39O6S+ea/61ar3dBmBNSU9ay229vin7sA=="
},
"payload": {
"countryCode": "TH",
"instructedCurrency": "THB",
"isForexRate": true,
"sourceCurrencyAlphaCode": "THB",
"targetCurrencyAlphaCode": "USD"
}
}
});
req.write(postData);
req.end();
Body
{
"id": "1",
"method": "VisaService.GetCurrencyGuide",
"params": {
"api": {
"credential": "Basic c3VwcG9ydCsxQG5ldHN5cy1pbmMuY29tOjM5ZDYxOGJkNTVmNzQ4ZGQ4ZWY4NWI5NWQxY2RlNDE5",
"signature": "MEQCICSDF4HIunb4xDLVEK9IOJYhT6j4wq5FwfJILSb4xbeSAiBdmpkV7uPB+39O6S+ea/61ar3dBmBNSU9ay229vin7sA=="
},
"payload": {
"countryCode": "TH",
"instructedCurrency": "THB",
"isForexRate": true,
"sourceCurrencyAlphaCode": "THB",
"targetCurrencyAlphaCode": "USD"
}
}
}
Response: 201
Response Parameters
Parameter | Description |
---|---|
jsonrpc | String JSON RPC VERSION Example – "2.0" |
result | Object |
effectiveConversionRate | Decimal Effective conversion rate Example – 0.029169 |
targetCurrency | String target currency for the conversion Example – "USD" |
sourceCurrency | String Represents the source currency for the conversion Example – "THB" |
rateExpiry | String Indicates the expiry date and time of the conversion rate Example – "2024-02-29T12:11:23.472Z" |
rateId | String A unique identifier for the conversion rate Example – "62091147-76f1-4603-9e07-61acfa6c5a57" |
currencyGuide | Object |
countryName | String Name of country Example – "Thailand" |
countryCode | String Country code Example – "TH" |
countryCodeIso3 | String The ISO 3166-1 alpha-3 country code Example – "THA" |
currency | String Currency code Example – "THB" |
currencyNumeric | String The numeric code associated with the currency Example – "764" |
requiredFields | Object |
accountNumber | String Specifies whether an account number is required Example – "true |
bic | String Specifies whether BIC is required Example – true |
paymentPurpose | String Specifies whether a payment purpose is required Example – true |
pattern | Object |
bic | Object |
regex | Object |
regex | String Regular expression pattern for validating a BIC Example – "^([A-Z]4)([A-Z]2)(([A-Z0-9]2))([0-9A-Z]3)?$" |
message | String A message indicating the reason for BIC validation failure Example – "Creditor BIC invalid" |
id | String Unique ID of the request Example – "1" |
{
"jsonrpc": "2.0",
"result": {
"effectiveConversionRate": 0.029169,
"targetCurrency": "USD",
"sourceCurrency": "THB",
"rateExpiry": "2024-02-29T12:11:23.472Z",
"rateId": "62091147-76f1-4603-9e07-61acfa6c5a57",
"currencyGuide": {
"countryName": "Thailand",
"countryCode": "TH",
"countryCodeIso3": "THA",
"currency": "THB",
"currencyNumeric": "764",
"requiredFields": {
"accountNumber": true,
"bic": true,
"paymentPurpose": true
},
"pattern": {
"bic": {
"regex": {
"regex": "^([A-Z]{4})([A-Z]{2})(([A-Z0-9]{2}))([0-9A-Z]{3})?$",
"message": "Creditor BIC invalid."
}
}
}
}
},
"id": "1"
}